home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / oscil / oscil.dem next >
Text File  |  1999-09-16  |  1KB  |  53 lines

  1.   mode(1)
  2. //
  3. //             ------------------------------
  4. //                     SIMULATION  
  5. //             ------------------------------
  6. //
  7. //                   L                   R     i2
  8. //           -----@@@@@@--------------^v^v^v^v-----
  9. //           !                      !             !
  10. //           !i1                     -----! !------
  11. //           !                             C      !
  12. //           -----(E)------------------------------
  13. //
  14.    halt()
  15. // 
  16.    l=10; r=1000; c=0.000001; e=10; pe1=0.002; pe2=0.0001;
  17. // 
  18.    getf('SCI/demos/oscil/oscil.sci','c')
  19.    halt()
  20. // initialization : 
  21. // --------------   
  22. //                  
  23.    y0 = [0;0];
  24.    t0 = 0;
  25.    t  = 0:.00003:0.005;
  26. //  solution
  27. // ----------
  28.    yt=ode('adams',y0,t0,t,fty);
  29.    halt()
  30. // plot
  31. // ------
  32.   [m,n]=size(t); en=t;
  33.    en=ene1(t,pe1,pe2);
  34. //
  35.  
  36. xbasc()
  37. plot2d([t;t]',yt')
  38. xtitle(['main intensity';'resistor'],...
  39.       'time','intensity');
  40. //
  41. cw=xget("window");c_c=cw;if cw>=1 then;cw=cw-1;else cw=cw+1;end
  42. xset("window",cw); xbasc(cw);
  43. plot2d2("gnn",t',en',[-1,1],"111",...
  44.      "en",[mini(t),mini(en)-0.5,maxi(t),maxi(en)+0.5])
  45. xset("window",c_c); 
  46. //
  47. //    save
  48. // ----------
  49. //
  50. //   save('oscil.sa');
  51. halt();
  52. xbasc(0:1);
  53.